using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UnitBase : MonoBehaviour
{
    private Transform head;
    private Transform body;
    private Transform neck;
    public Transform muzzle;

    private bool haveHead;
    private bool haveNeck;
    bool isCharacter;
    public void Start()
    {
        head = transform.Find("head");
        body = transform.Find("body");
        neck = transform.Find("neck");
        muzzle = transform.Find("muzzle");

        haveNeck = neck == null ? false : true;
    }
    public void SetData(BaseItemScript baseItemScript)
    {
        isCharacter = baseItemScript.itemData.configuration.isCharacter;
    }
    public void Refresh() { }
    public void ShowGroundPatch(bool show) { }
    public void LookAt(Vector3 point)
    {
        if (isCharacter)
            transform.LookAt(new Vector3(point.x, 0, point.z));
        else if(haveHead)
        {
            head.LookAt(point);
        }
    }
    void Update()
    {
        
    }
}
